﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class WeaponManager : IActorManagerChild
{
    
    //public Transform whL;
    public Transform whR;
    public BoxCollider col;
    // Start is called before the first frame update
    void Start()
    {
        Debug.Log("OK");
        if (whR == null)
        {
            whR = dfs(transform, "whR");            
        }
        if (col == null)
        {
            if (whR != null)
            {
                col = whR.GetComponent<BoxCollider>();
            }
        }
        //col = whR.GetComponent<BoxCollider>();
    }

    // Update is called once per frame
    void Update()
    {
        

    }

    public void WeaponEnable() {
        col.enabled = true;
    }

    public void WeaponDisable()
    {
        col.enabled = false;
    }

    public Transform dfs(Transform node, string name) {
        if (node.name == name) {
            return node;
        }
        Transform ret = null;
        foreach (Transform ch in node) {
            ret = dfs(ch, name);
            if (ret != null) {
                return ret;
            }
        }
        return ret;
    }
}
